<template>
    <basic-container>

        <div style="width:50%;margin-top: 10px;">
            <avue-form ref="form" v-model="objA" :option="optionA"  @submit="submitA">
            </avue-form>
        </div>

    </basic-container>
</template>
<script>
    import{
        setSms,
        getSms
    } from "../../api/base/sysSet/smsSet";
    import {
        convertAddCode
    } from '@/util/util';

    export default {
        data() {
            return {
                activeName: 'A',
                objA:{},
                objB:{},
                optionA:{
                    emptyBtn:false,
                    labelWidth:'200',
                    labelPosition:'left',
                    column: [{
                        label: "服务地址",
                        prop: "dongshifangUrl",
                        tip:'东方时服务地址',
                        span: 24,
                        rules: [{
                            required: true,
                            message: "请输入东方时服务地址",
                            trigger: "blur"
                        }]
                    },{
                        label: "企业代码",
                        prop: "dongshifangEnterpriseId",
                        tip:'东方时企业代码',
                        span: 24,
                        rules: [{
                            required: true,
                            message: "请输入东方时企业代码",
                            trigger: "blur"
                        }]
                    },{
                        label: "用户账号",
                        prop: "dongshifangUserId",
                        tip:'东方时用户账号',
                        span: 24,
                        rules: [{
                            required: true,
                            message: "请输入东方时用户账号",
                            trigger: "blur"
                        }]

                    }
                        ,{
                            label: "组合通道",
                            prop: "dongshifangGatewayId",
                            tip:'东方时组合通道',
                            span: 24,
                            rules: [{
                                required: true,
                                message: "请输入东方时组合通道",
                                trigger: "blur"
                            }]

                        }
                        ,{
                            label: "用户密码Md5散列",
                            prop: "dongshifangPasswordMd5",
                            tip:'东方时用户密码Md5散列',
                            span: 24,
                            rules: [{
                                required: true,
                                message: "请输入东方时用户密码Md5散列",
                                trigger: "blur"
                            }]

                        }
                        ,{
                            label: "短信内容前缀",
                            prop: "dongshifangSignature",
                            tip:'东方时短信内容前缀',
                            span: 24,
                            rules: [{
                                required: true,
                                message: "请输入东方时短信内容前缀",
                                trigger: "blur"
                            }]

                        },{
                            label: "短信字数限制（包含前缀字数）",
                            prop: "dongshifangSmsCountLimit",
                            tip:'东方时短信字数限制',
                            span: 24,
                            rules: [{
                                required: true,
                                message: "常规短信限制70，长短信300",
                                trigger: "blur"
                            }]

                        }]
                },


            }
        },
        //页面初始化
        created(){
            this.getData()
        },
        methods: {
            getData(){
                getSms().then(res=>{
                    if(res.data.code==200){
                        this.objA=res.data.data
                    }
                })
            },
            submitA (form,done) {
/*
                convertAddCode(this.objA.emay_app_id,data=>{
                    this.objA.emay_app_id = data;
                });

                convertAddCode(this.objA.emay_secret_key,data=>{
                    this.objA.emay_secret_key = data;
                });*/
                setSms(this.objA).then(res=>{
                    done()
                        this.$message({
                            message:'提交成功',
                            type:'success'
                        })
                        this.getData()

                })

            },


        }
    };
</script>
<style>
    h5{
        color: darkred;
        font-weight: bold;
    }
    p{
        line-height: 30px;
    }

</style>